#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


int main()
{
    ll T;
    cin >> T;
    while (T--)
    {
        ll n, k;
        cin >> n >> k;
        vector<ll> a(n);
        vector<ll>arr(k, 0);
        for (int i = 0; i < n; ++i)
        {
            cin >> a[i];
            if (a[i] <= k)
            {
                arr[a[i] - 1]++;
            }
        }
        sort(arr.begin(), arr.end());
        bool flag = true;
        for (int i = 1; i <= k; ++i)
        {
            if (arr[i - 1] != 0)
            {
                continue;
            }
            else
            {
                flag = false;
                break;
            }
        }


        if (flag)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}



int main()
{
    ll T;
    cin >> T;
    while (T--)
    {
        double a;
        cin >> a;
        // x=a+1/x
        // x^2=ax+1
        // x^2-ax-1=0;
        double x = (a + sqrt(a * a + 4)) / 2;
        cout << fixed << setprecision(10) << x << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll T;
    cin >> T;
    while (T--)
    {
        ll n, sum;
        cin >> n >> sum;
        vector<ll>arr(n);
        ll sum1 = 0;
        for (int i = 0; i < n; ++i)
        {
            cin >> arr[i];
            sum1 += arr[i];
        }

        int count = 0;
        if (sum1 == sum)
        {
            cout << 0 << endl;
        }
        else if (sum1 < sum)
        {
            sort(arr.begin(), arr.end());
            for (int i = 0; i < n; ++i)
            {
                if (sum1 + 1e4 - arr[i] < sum)
                {
                    sum1 += 1e4 - arr[i];
                    count++;
                }
                else
                {
                    count++;
                    break;
                }
            }
            cout << count << endl;
        }
        else
        {
            sort(arr.begin(), arr.end());
            for (int i = n - 1; i >= 0; --i)
            {
                if (sum1 - 1e4 - arr[i] > sum)
                {
                    sum1 -= arr[i] + 1e4;
                    count++;
                }
                else
                {
                    count++;
                    break;
                }
            }
            cout << count << endl;
        }
    }
    return 0;
}